<%--
/**
* Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
--%>
<%@page import="com.crossriver.crgis.database.service.persistence.Application_C_of_OUtil"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@page import="com.crossriver.crgis.database.model.Application_C_of_O"%>
<%@ page import="com.crossriver.crgis.cofo.util.ApplicationCofOConstants"%>
<%@ include file="/init.jsp"%>


<portlet:defineObjects />

<%
Application_C_of_O appl = (Application_C_of_O) request.getAttribute(ApplicationCofOConstants.APPL_C_OF_O_SESSION_ATTR);

Application_C_of_O applicatn = 
	Application_C_of_OUtil.findByPrimaryKey(appl.getApplicationId());
%>
<liferay-portlet:actionURL name="saveOldFileInfomation" var="saveOldFileInfomation"></liferay-portlet:actionURL>
<liferay-ui:error key="old-cofo-mandatory" message="old-cofo-mandatory" />
<liferay-ui:error key="file-no-mandatory" message="file-no-mandatory" />

<liferay-ui:success key="file-information-save-success" message="file-information-save-success"></liferay-ui:success>


 <aui:form action="<%=saveOldFileInfomation.toString() %>" method="post" name="saveOldFileInfomation_fm">
 
  <% String app = applicatn.getApplication(); %>
 <div id="main">
	<%
	if("certification".equalsIgnoreCase(app)){
	%>
	<h1>Application for Certificate Of Occupancy</h1>
	<%
	}else if("re-certification".equalsIgnoreCase(app)){
	%>
	<h1>Application for Re-Certificate Of Occupancy</h1>
	<%
	}else {
	%>
	<h1>Application for State Land</h1>
	<%
	}
	%>
<!-- </div>	 -->
  <div class="content">
  	<table width="100%" border="0" cellpadding="0" cellspacing="0">
    	<tr>
     	<td width="15%" valign="top">
     		<aui:input name="applicationId" type="hidden" value="<%= appl.getApplicationId() %>"></aui:input>
     		<aui:input name="buttonClicked" type="hidden" value=""></aui:input>
        <table width="100%" id="steps" cellpadding="0" cellspacing="0">
       		<tr><td valign="middle" align="center" class="current">STEP 1</td></tr>
       		<tr><td valign="middle" align="center">STEP 2</td></tr>
	        <tr><td valign="middle" align="center">STEP 3</td></tr>
          <tr><td valign="middle" align="center">STEP 4</td></tr>
          <tr><td valign="middle" align="center">STEP 5</td></tr>
          <tr><td valign="middle" align="center">STEP 6</td></tr>
          <tr><td valign="middle" align="center">STEP 7</td></tr>
          <tr><td valign="middle" align="center">STEP 8</td></tr>                               
       	</table>
     	</td>
      <td width="85%" valign="top">
      		<table width="100%" id="mainform">
         		<tr>
         			<td class="title" colspan="3">Old File Information</td>
            </tr>
            <tr>
            	<td colspan="3" align="right" class="buttons">
	            	<hr>
	            	<aui:button type="button" value="Exit Application" onClick="exitApplication();"></aui:button>
	             	<aui:button type="submit" value="Save" onClick="setButtonClicked('btnSave');" ></aui:button>
	            	<aui:button type="submit" value="Save and Continue" onClick="setButtonClicked('btnSaveAndContinue');" ></aui:button>
	             	<aui:button type="button" value="Cancel Application" onClick="confirmPost()"></aui:button>
              </td>
           	</tr>
            <tr>
        			<td colspan="3"><br>
	           		<aui:input name="oldCofONo" 
		           		label="Enter old Certificate of Occupancy number<span class='mandatoryfld'>*</span>"
		           		value="<%=appl.getOldCofONo() %>">
		           	</aui:input>
        			</td>
    				</tr>
            <tr>
	        		<td colspan="3"><br>
	           		<aui:input name="fileNo" 
		           		label="Enter your file number<span class='mandatoryfld'>*</span>"
		           		value="<%=appl.getFileNo() %>">
		           	</aui:input>
	        		</td>
	    			</tr>
            <tr>
	        		<td colspan="3">
	           		<br><hr>
                <p><strong>All fields asterisk in "Red" are compulsory</strong></p>
                <p>
                It is the applicant's responsibility to fill out the Personal Information Form.
                If a given category does not apply place the letters N/A in the space to indicate Not Applicable.</p>
                <p>The Personal Information Form MUST BE filled by the applicant. Your Personal Information Form will
                be one of the main sources in determining your eligibility for the award of Certificate Of Occupancy.</p>
	           	</td>
    				</tr>
            <tr>
            	<td colspan="3" align="right">
              	<br>
								<aui:button type="button" value="Exit Application" onClick="exitApplication();"></aui:button>
             	<aui:button type="submit" value="Save" onClick="setButtonClicked('btnSave');" ></aui:button>
            	<aui:button type="submit" value="Save and Continue" onClick="setButtonClicked('btnSaveAndContinue');" ></aui:button>
             	<aui:button type="button" value="Cancel Application" onClick="confirmPost()"></aui:button>
              </td>
            </tr>
        	</table>
     	</td>
   		</tr>
  	</table>
	</div>
</div>
  			<script type="text/javascript">
	function setButtonClicked(id)
	{
		//alert(id);
	   document.<portlet:namespace/>saveOldFileInfomation_fm.<portlet:namespace/>buttonClicked.value=id;
	  // alert(document.<portlet:namespace/>quick_add_account_fm.<portlet:namespace/>buttonClicked.value);
	    //document.getElementById('jspPage').value=id;
	}

	function selectOptions()
	{
	   // alert(id);
	   document.<portlet:namespace/>saveOldFileInfomation_fm.<portlet:namespace/>fileNo.value='<%= appl.getFileNo() %>';
	   document.<portlet:namespace/>saveOldFileInfomation_fm.<portlet:namespace/>oldCofONo.value='<%= appl.getOldCofONo() %>';
	  	}

	selectOptions();
	
	</script>
</aui:form>

	<liferay-portlet:actionURL name="exitApplication" var="exitApplication"></liferay-portlet:actionURL>
	<form name="<portlet:namespace/>exitApplication_fm" method="post"	id="<portlet:namespace/>exitApplication_fm" action="<%=exitApplication.toString()%>"></form>
	<script type="text/javascript">
	<!--
	function exitApplication()
	{
		document.forms["<portlet:namespace/>exitApplication_fm"].submit();
	}
	//-->
	</script>

<script type="text/javascript">
<!--
	function confirmPost()
	{
	var agree=confirm("Cancelling the process will delete the record you have entered into the portal for this application. Do you want to proceed?");
	if (agree){
		document.forms["<portlet:namespace/>deleteApplication_fm"].submit();
		return true ;
	}
	else{
		return false ;
	}
	
	}
//-->
</script>

<liferay-portlet:actionURL name="deleteApplication" var="deleteApplication"></liferay-portlet:actionURL>
 <aui:form action="<%=deleteApplication.toString() %>" method="post" name="deleteApplication_fm">
  	<aui:input name="applicationId" type="hidden" value="<%=appl.getApplicationId() %>"></aui:input>
 </aui:form>
 
 